package com.yg.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;


@Configuration//说明这是一个配置类
public class SwaggerConifg {

    /**
     * 配置Swagger的Docket实例
     * apiInfo：Swagger信息
     * @return
     */
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo());
    }
    /**
     * Contact
     *      name：作者名
     *      url：作者地址
     *      email：作者邮箱
     *  ApiInfo
     *      title：标题
     *      description：描述
     *      version：版本
     *      termsOfServiceUrl：组织的地址
     *      concat：作者描述
     * @return
     */
    private ApiInfo apiInfo(){
        Contact contact = new Contact("英谷教学管理系统","localhost:8001","xxxx@qq.com");
        return new ApiInfo(
                "测试文档",
                "Swagger文档",
                "v1.0",
                "localhost:8001",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>()
        );
    }



}